Skip to content

test: migrate math/base/special/croundn to ULP-based assertions - #14327

Merged
kgryte merged 1 commit into
developfrom
kgryte/ulp-croundn
Aug 16, 2026
Merged

test: migrate math/base/special/croundn to ULP-based assertions#14327
kgryte merged 1 commit into
developfrom
kgryte/ulp-croundn

Conversation

@kgryte

@kgryte kgryte commented Aug 16, 2026

Copy link
Copy Markdown
Member

Resolves a part of #11352.

Description

What is the purpose of this pull request?

This pull request:

  • migrates the tests for math/base/special/croundn from relative tolerance testing to ULP difference testing.
  • replaces the delta/tol relative error comparison in test/test.js and test/test.native.js with isAlmostSameValue( actual, expected[ i ], 1 ) assertions, adding the @stdlib/assert/is-almost-same-value require and dropping the now unused @stdlib/constants/float64/eps and @stdlib/math/base/special/abs requires.

The affected test is the function supports rounding very small numbers (including subnormals), which compares both the real and imaginary components against the expected fixture values.

ULP constants used:

File ULP
test/test.js 1
test/test.native.js 1

Both values were tightened to the measured minimum: the maximum observed ULP difference over the full fixture set is 1 for the JavaScript implementation and 1 for the native implementation, and re-running the suite with a bound of 0 fails 10 assertions in each file. The suite was run twice at the final bound to confirm the results are deterministic (690 passing in test/test.js, 684 passing in test/test.native.js, with the native add-on compiled locally so that the native tests actually execute rather than skip).

Only the two test files are modified.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

This PR was authored by Claude Code running as an automated task. The ULP bounds were measured empirically against the existing fixtures rather than guessed.


@stdlib-js/reviewers


Generated by Claude Code

Replaces relative tolerance assertions in the `croundn` tests with
`isAlmostSameValue` ULP difference assertions. The minimum ULP value
which passes the full fixture set is 1 for both the JavaScript and
native implementations.

Ref: #11352

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TfarAoSHwhj3MftfXNKEnn
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Good First PR A pull request resolving a Good First Issue. labels Aug 16, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/croundn $\\color{green}176/176$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}2/2$
$\\color{green}+100.00\\%$
$\\color{green}176/176$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte kgryte added the Tests Pull requests specifically adding tests. label Aug 16, 2026
@kgryte
kgryte marked this pull request as ready for review August 16, 2026 23:05
@kgryte
kgryte requested a review from a team August 16, 2026 23:05
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 16, 2026
@kgryte
kgryte merged commit 4557073 into develop Aug 16, 2026
82 checks passed
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Math Issue or pull request specific to math functionality. Tests Pull requests specifically adding tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants